package com.acane.instagram.feature.search

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.compose.composable

const val SEARCH_ROUTE = "search"
const val SEARCH_DETAIL_ROUTE = "search_detail"
fun NavGraphBuilder.searchScreen(
    navController: NavHostController,
    toSearchDetail: () -> Unit,
) {
    composable(SEARCH_ROUTE) {
        SearchRoute(
            toSearchDetail = toSearchDetail,
        )
    }
}

fun NavController.navigateToSearch(): Unit {
    navigate(SEARCH_ROUTE)
}

fun NavGraphBuilder.searchDetailScreen(
    navController: NavHostController,
    toProfile: (String) -> Unit,
    toPost: (String, Int) -> Unit,
    toDetail: (String) -> Unit,
) {
    composable(SEARCH_DETAIL_ROUTE) {
        SearchDetailRoute(
            navController = navController,
            toProfile = toProfile,
            toPost = toPost,
            toDetail = toDetail,
        )
    }
}

fun NavController.navigateToSearchDetail(): Unit {
    navigate(SEARCH_DETAIL_ROUTE)
}